home *** CD-ROM | disk | FTP | other *** search
/ Steal This CD / steal_this_cd.iso / Chapter 07 - Where the Hackers Are / virc200.exe / {app} / Scripts / smileys.vsc < prev    next >
Text File  |  2003-05-16  |  3KB  |  108 lines

  1. // smileys.vsc - shows graphical smiley icons
  2. // * To add more smileys, put the .bmp files in your image folder, then
  3. //   edit the @l line at the top of the DOSMILEYS alias.
  4.  
  5. Name Smileys for ViRC 2
  6.  
  7. // Version check
  8.  
  9. if $exebuild < 114
  10.   MessageBox smileys.vsc requires ViRC 2.0rc2 (200/114 or later).
  11.   Halt
  12. endif
  13.  
  14. // Set up images
  15.  
  16. @ $Smileys = $null
  17.  
  18. @ $Smileys[:)] = smile.bmp
  19. @ $Smileys[;)] = wink.bmp
  20. @ $Smileys[>:(] = angry.bmp
  21. @ $Smileys[:(] = frown.bmp
  22. @ $Smileys[:D] = grin.bmp
  23. @ $Smileys[:P] = tongue.bmp
  24. @ $Smileys[:p] = tongue.bmp
  25.  
  26. // Verify image files
  27.  
  28. @l $notfound = $null
  29. foreach ($file; $arrayvalues($Smileys))
  30.   if !$fileexists($getpath(image)$file)
  31.     @l $notfound = $listcat($notfound $listquote($file))
  32.   endif
  33. endforeach
  34.  
  35. if [$notfound] != []
  36.   @l $msg = Some image files for smileys.vsc could not be found. You will not be able to see graphical smileys unless the files are in your image folder ($getpath(image)). The missing files are:$char(13)
  37.   foreach ($file; $notfound)
  38.     @l $msg = $msg$char(13)$file
  39.   endforeach
  40.   @l $msg = $msg$char(13)$char(13)The files are probably in the Images directory in your ViRC folder ($getpath(virc)Images). Please move them to $getpath(image) and restart ViRC.
  41.   MessageBox $msg
  42. endif
  43.  
  44. // Settings
  45.  
  46. AddScriptControl config check "Show graphical smileys" smileys_enabled = 1
  47.  
  48. // Aliases
  49.  
  50. Alias DOSMILEYS
  51.   if $getsetting(smileys_enabled)
  52.     @l $subst = $null
  53.     foreach ($from,$to; $Smileys)
  54.       @l $subst = $listcat($subst $listquote( $from ) $listquote( \S@bmp:$bitmap($to):$from\S ))
  55.     endforeach
  56.  
  57.     // add a temporary space on each end to match smileys at the beginning/end
  58.     @l $x = $replace($listquote( $1- ) $subst)
  59.     @ $fresult = $substr($x 2 $($length($x) - 2))
  60.   else
  61.     @ $fresult = $1-
  62.   endif
  63. EndAlias
  64.  
  65. // Events
  66.  
  67. Event PRIVMSG_smileys -before "% PRIVMSG"
  68.   // don't edit ctcp requests
  69.   if [$substr($3 2 1)] != [\A]
  70.     SetEventLine $0 $1 $2 :$dosmileys($strtrim($3-))
  71.   endif
  72. EndEvent
  73.  
  74. Event NOTICE_smileys -before "% NOTICE"
  75.   // don't edit ctcp replies
  76.   if [$substr($3 2 1)] != [\A]
  77.     SetEventLine $0 $1 $2 :$dosmileys($strtrim($3-))
  78.   endif
  79. EndEvent
  80.  
  81. Event <OnMyChanText_smileys> -before "*"
  82.   SetEventLine $0 $dosmileys($1-)
  83. EndEvent
  84.  
  85. Event <OnMyPrivMsg_smileys> -before "*"
  86.   SetEventLine $0 $dosmileys($1-)
  87. EndEvent
  88.  
  89. Event <OnMyQueryText_smileys> -before "*"
  90.   SetEventLine $0 $dosmileys($1-)
  91. EndEvent
  92.  
  93. Event <OnMyQueryAction_smileys> -before "*"
  94.   SetEventLine $0 $dosmileys($1-)
  95. EndEvent
  96.  
  97. Event <OnMyChanAction_smileys> -before "*"
  98.   SetEventLine $0 $dosmileys($1-)
  99. EndEvent
  100.  
  101. Event <OnMyPrivAction_smileys> -before "*"
  102.   SetEventLine $0 $dosmileys($1-)
  103. EndEvent
  104.  
  105. Event <OnMyNotice_smileys> -before "*"
  106.   SetEventLine $0 $dosmileys($1-)
  107. EndEvent
  108.